#!/bin/bash

num=$1

if [ $num -le 0 ]
  then
      echo "您输入的数为负数或0"
elif [ $num -gt 150 ];then
  echo "您输入的数不能大于150"
elif [ $num -eq 1 ]
  then
      echo "This is not a prime number"
elif [ $num -eq 2 ]
  then
      echo "This is a prime number"
else
  for ((i=2;i<$num;i++))
      do
          if [ $(($num%i)) -eq 0 ]
            then
               [ $num -ne $(($num%i)) ] && echo "This is not a prime number" && break
          else
               if [ $i -gt $(($num/2)) ]
                 then
                     echo "This is a prime number" && break
               fi
          fi
      done

fi
